import * as types from "./mutation-types";

export const expandMenu = ({ commit }, menuItem) => {
  if (menuItem) {
    menuItem.expanded = menuItem.expanded || false;
    commit(types.EXPAND_MENU, menuItem);
  }
};
export const toggleDevice = ({ commit }, device) =>
  commit(types.TOGGLE_DEVICE, device);
export const toggleSidebar = ({ commit }) => commit(types.TOGGLE_SIDEBAR);

export const handleSidebar = ({ commit }, playload) =>
  commit(types.HANDLE_SIDEBAR, playload);

export const selectHeaderMenu = ({ commit }, playload) =>
  commit(types.SELECT_HEADER_MENU, playload);

export const set_header_menu = ({ commit }, playload) =>
  commit(types.SET_HEADER_MENU, playload);

export const toggleHeader = ({ commit }) => commit(types.TOGGLE_HEADER);

export const handleHeader = ({ commit }, playload) =>
  commit(types.HANDLE_HEADER, playload);

export const switchEffect = ({ commit }, effectItem) => {
  if (effectItem) {
    commit(types.SWITCH_EFFECT, effectItem);
  }
};

export const toggleSearchModal = ({ commit }) =>
  commit(types.TOGGLE_SEARCH_MODAL);

export const handleSearchModal = ({ commit, playload }) =>
  commit(types.HANDLE_SEARCH_MODAL, playload);

export const toggleSearchModalFilter = ({ commit }) =>
  commit(types.TOGGLE_SEARCH_MODAL_FILTER);

export const handleSearchModalFilter = ({ commit, playload }) =>
  commit(types.HANDLE_SEARCH_MODAL_FILTER, playload);

export const toggleMobileNavigationBar = ({ commit }) =>
  commit(types.TOGGLE_MOBILENAVIGAIONBAR);

export const handleMoileNavigationBar = ({ commit, playload }) =>
  commit(types.TOGGLE_MOBILENAVIGAIONBAR, playload);

export const toggleNotificationModal = ({ commit }) =>
  commit(types.TOGGLE_NOTIFICATION_MODAL);

export const handleNotificationModal = ({ commit, playload }) =>
  commit(types.HANDLE_NOTIFICATION_MODAL, playload);
